/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ocumed.presentation.termin;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import ocumed.applikation.terminverwaltung.TerminVergeben;
import org.jdesktop.swingx.JXTable;

/**
 *
 * @author apr3455
 */
public class KalenderTerminUebersicht extends TerminKalender {
    
    Object[] m_aerzteListe = null;
    HashMap<Integer, String> m_aerzte = null;
    
    
    public KalenderTerminUebersicht(JXTable table, TerminVergeben controller){
        super(table, controller);
    }
    
    @Override
    public int getHeaderCount(){
        m_aerzteListe = (m_aerzteListe == null)? m_controller.getArztListe().keySet().toArray(): m_aerzteListe;
        return m_aerzteListe.length + 1;
    }
    
    @Override
    public int getArztId(int col){
        m_aerzteListe = (m_aerzteListe == null)? m_controller.getArztListe().keySet().toArray(): m_aerzteListe;
        return (Integer) m_aerzteListe[col - 1];
    }
    
    @Override
    public void setNextDay(Calendar cal){
        //nothing to do;
    }

    @Override
    public Date getFirstDayOfWeek(Date d) {
        return d;
    }

    @Override
    protected void setColumnHeaders(Date date) {
        SimpleDateFormat df = new SimpleDateFormat("dd.MM.yy");
        m_aerzte = (m_aerzte == null)? m_aerzte = m_controller.getArztListe(): m_aerzte;
        m_columnNames = (m_columnNames == null)? new String[getHeaderCount()]: m_columnNames;
        m_Dates = (m_Dates == null)? new String[getHeaderCount()]: m_Dates;
        m_columnNames[0] = "Uhrzeit";
        int currId = 0;
        for(int i = 1; i < m_aerzte.size() + 1; i++){
            m_columnNames[i] = m_aerzte.get(getArztId(i));
            m_Dates[i] = df.format(date).toString();
            m_dateCol.put(df.format(date).toString(), i);
        }
    }
    
    

}
